stylecontext: Make build_properties create the style
authorBenjamin Otte <otte@redhat.com>
Sun, 14 Dec 2014 22:20:19 +0000 (23:20 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 7 Jan 2015 13:26:47 +0000 (14:26 +0100)
gtk/gtkstylecontext.c

index ba7763c79720791ea99f93b521bbf8abce8e92b1..bc798213703e6779e8e017f6409aefce4d935991 100644 (file)
@@ -713,9 +713,8 @@ update_properties (GtkStyleContext             *context,
   gtk_widget_path_free (path);
 }
 
-static void
+static GtkCssStyle *
 build_properties (GtkStyleContext             *context,
-                  GtkCssStyle                 *style,
                   const GtkCssNodeDeclaration *decl,
                   GtkCssChange                *out_change)
 {
@@ -723,9 +722,12 @@ build_properties (GtkStyleContext             *context,
   GtkCssMatcher matcher;
   GtkWidgetPath *path;
   GtkCssLookup *lookup;
+  GtkCssStyle *style;
 
   priv = context->priv;
 
+  style = gtk_css_static_style_new ();
+
   path = create_query_path (context, decl);
   lookup = _gtk_css_lookup_new (NULL);
 
@@ -743,6 +745,8 @@ build_properties (GtkStyleContext             *context,
 
   _gtk_css_lookup_free (lookup);
   gtk_widget_path_free (path);
+
+  return style;
 }
 
 static GtkCssStyle *
@@ -770,18 +774,15 @@ style_values_lookup (GtkStyleContext *context)
           return values;
         }
 
-      values = gtk_css_static_style_new ();
+      values = build_properties (context, info->decl, NULL);
       g_hash_table_insert (priv->style_values,
                            gtk_css_node_declaration_ref (info->decl),
                            g_object_ref (values));
 
-      build_properties (context, values, info->decl, NULL);
     }
   else
     {
-      values = gtk_css_static_style_new ();
-
-      build_properties (context, values, info->decl, &priv->relevant_changes);
+      values = build_properties (context, info->decl, &priv->relevant_changes);
       /* These flags are always relevant */
       priv->relevant_changes |= GTK_CSS_CHANGE_SOURCE;
     }
@@ -807,8 +808,7 @@ style_values_lookup_for_state (GtkStyleContext *context,
 
   decl = gtk_css_node_declaration_ref (context->priv->info->decl);
   gtk_css_node_declaration_set_state (&decl, state);
-  values = gtk_css_static_style_new ();
-  build_properties (context, values, decl, NULL);
+  values = build_properties (context, decl, NULL);
   gtk_css_node_declaration_unref (decl);
 
   return values;